package cn.codergege.kotlinclass.obj

// 单例模式
object SingletonDemo {
    val username: String get() = "root"
    var password: String = ""

    fun getInfo() = "username: $username, password: $password"
}

fun main(args: Array<String>) {
    val info: String
    SingletonDemo.password = "123456"
    info = SingletonDemo.getInfo() // object 类使用时直接用类名就可以了
    println(info)
}